import type { RouteRecordRaw } from 'vue-router';
import { REDIRECT_ROUTE_NAME } from '@/router/constants';

// 默认布局
export const DEFAULT_LAYOUT = () => import('@/layout/index.vue');

// 默认页面
export const ROOT_ROUTER: RouteRecordRaw = {
  path: '/',
  redirect: 'login',
};
// 登录页面
export const LOGIN_ROUTER: RouteRecordRaw = {
  path: '/login',
  name: 'login',
  meta: {
    requiresAuth: false,
    locale: '登录',
  },
  component: () => import('@/views/login/index.vue'),
};
// 重定向页面
export const REDIRECT_ROUTER: RouteRecordRaw = {
  path: '/redirect',
  name: 'redirectWrapper',
  component: DEFAULT_LAYOUT,
  meta: {
    locale: '重定向',
    hideInMenu: true,
  },
  children: [
    {
      path: '/redirect/:path',
      name: REDIRECT_ROUTE_NAME,
      component: () => import('@/views/foundation/redirect/index.vue'),
      meta: {
        locale: '重定向',
        hideInMenu: true,
        noAffix: true,
      },
    },
  ],
};

// 404 页面
export const NOT_FOUND_ROUTE: RouteRecordRaw = {
  path: '/:pathMatch(.*)*',
  name: 'notFound',
  component: () => import('@/views/foundation/not-found/index.vue'),
};

export default [ROOT_ROUTER, LOGIN_ROUTER, REDIRECT_ROUTER, NOT_FOUND_ROUTE];
